<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
	
	<script src="${ctx}/js/controllers/base/appconfig/AppConfigListController.js" type="text/javascript"></script>
          <section>
              <div style="height:40px;line-height: 40px;">
                    <div class="forword_area"></div>
					<div class="location">当前位置：${sessionScope.currcent_position}</div>

              </div>
              <hr>
              <section>
                <!--begin 搜索栏 -->
                <div class="panel">
	                <div style="float:left;height: 28px;width:130px;">
	                    <input id="imgName" type="text" maxlength="20" value="${(not empty imgName)? imgName : ''  }" class="input-sm" placeholder="名称">&nbsp;&nbsp;
		          	</div>
		          	<div class="btn-group">
                        <select id="objType" class="dropdown-menu">
                        	<option value="-1" <c:if test="${objType == -1 }">selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;图标类型</option>
                            <option value="0" <c:if test="${objType == 0 }">selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;首页图标</option>
                            <option value="1" <c:if test="${objType == 1 }">selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;商城图标</option>
                        </select>
                    </div>
		          	<div class="btn-group">
						<select class="dropdown-menu" id="pSize">
							<c:forEach items="${pageSizes }" var="item">
								<option value="${item.value }"
									<c:if test="${pSize == item.value }">selected</c:if>>&nbsp;&nbsp;&nbsp;${item.label }</option>
							</c:forEach>
						</select>
					</div>
		             <div class="form-control">
		                 <div class="search" onclick="getAppConfigList();" ><img src="${ctx }/images/table/search_second.png"></div>
		               	 <div class="search" onclick="saveOrUpdate();" ><img src="${ctx }/images/table/add_second.png"></div>
		             </div>
                </div><!--end 搜索栏 -->

                <!--begin table表格 -->
                <div>
                <table class="table">
                    <thead>
                      <tr>
                      	<th width="3%">
                           <img id="all" onclick="selectAll(this)" src="${ctx }/images/tables/wugou.png" style="margin-bottom: 1px;">
                        </th>
                        <th width="3%">序号</th>
                        <th width="10%">图片</th>
                        <th width="10%">图片名称</th>
                        <th width="10%">图片类型</th>
                        <th width="5%">排序</th>
                        <th width="8%">创建人</th>
                        <th width="10%">创建时间</th>
                        <th width="8%">操作</th>
                      </tr>
                    </thead>
                    <tbody id="tableTbody">
                      	<c:forEach items="${appConfig.list }" var="appConfig" varStatus="Status">
	                      <tr onmouseover="mouseoverOne(this)" onmouseout="mouseoutOne(this)">
	                      	<td>
	                      	<img id="appConfig${appConfig.id}" name="appConfigChecked" class="${appConfig.id}" onclick="selectOne('${appConfig.id}',this)" src="${ctx }/images/tables/wugou.png">
	                      	</td>
	                        <td>${Status.index + 1 }</td>
	                        <td style="padding:4px 0px;">
	                        	<c:if test="${not empty appConfig.imgUrl}">
	                       	 		<img width="80px;" height="80px;" src="${sessionScope.image_logo}${appConfig.imgUrl}"/>
	                       	 	</c:if>
	                        	<c:if test="${empty appConfig.imgUrl}">
	                       	 		<img width="80px;" height="80px;" src="${ctx}/images/config-default.png"/>
	                       	 	</c:if>
	                        </td>
	                        <td>${appConfig.imgName}</td>
	                        <td>
	                        	<c:if test="${appConfig.objType  == 0}">
	                        		首页小图标 
	                        	</c:if>
	                        	<c:if test="${appConfig.objType  == 1}">
	                        		商城小图标 
	                        	</c:if>
	                        	<c:if test="${appConfig.objType == -1}">
	                        	              图标类型（无）
	                        	</c:if>
	                       
	                        </td>
	                        <td>${appConfig.sort}</td>
	                        <td>${appConfig.userAccount}</td>
	                        <td>${appConfig.sendTime.substring(0,19)}</td>
	                        <td >
	                          <a class="fa fa-check " title="编辑" onclick="saveOrUpdate('${appConfig.id}');">编辑</a>
	                        </td>
	                      </tr>
                      	</c:forEach>
                    </tbody>               
                                      
                    <tfoot>
		            	<tr>
			               <td colspan="9">
			                  <div>
			                    <div style="float:left;">
			                      <span class="total">合计 ${appConfig.total} 条数据</span>               
			                    </div>
			                    <div style="float:right;  margin-right: 10px;margin-top: 26px"> 
				                  <div style="float:left;">                 
				                      <ul class="footer_ul">
				                      	<c:if test="${appConfig.hasPreviousPage }">
				                        <li onclick="gotoPage(${currentPage-1 });"><a class="leftRight">&lt;&lt;</a></li>
				                      	</c:if>
				                        <c:if test="${appConfig.firstPage > 1}">
				                        	<li onclick="gotoPage(1);" style="border: 1px solid #9A9A9A;">
				                             	<a>1</a>
				                        	</li>
				                        	<c:if test="${appConfig.firstPage > 2}">
				                        		...
				                        	</c:if>
				                      	</c:if>
				                        <c:forEach items="${appConfig.navigatepageNums }" var="page">
				                        <li onclick="gotoPage(${page });" class="<c:if test="${currentPage == page }">active</c:if>" style="border: 1px solid #9A9A9A;">
				                             <a>${page}</a>
				                        </li>
				                        </c:forEach>
				                        <c:if test="${appConfig.lastPage < appConfig.pages}">
				                        	<c:if test="${appConfig.firstPage < appConfig.pages - 1}">
				                        		...
				                        	</c:if>
				                        	<li onclick="gotoPage(${appConfig.pages});" style="border: 1px solid #9A9A9A;">
				                             	<a>${appConfig.pages}</a>
				                        	</li>
				                      	</c:if>
				                        <c:if test="${appConfig.hasNextPage }">
				                        <li><a onclick="gotoPage(${currentPage+1});" class="leftRight">&gt;&gt;</a></li>
				                      	</c:if>
				                      </ul>
			                     </div>
		                   		<div style="float:left;  height: 30px;line-height: 30px;">
									<span style="color: #9A9A9A;">跳转到</span> 
									<input class="inputclass" id="pageNo" onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}" type="text" value="${currentPage }" style="width:26px;height:28px" onkeyup = "checInputNum(this)">
									<span style="color: #9A9A9A;">页</span> 
									<span class="buttonclass" id="J_JumpTo" onclick="gotoAppConfigPage(null);"><a>GO</a></span>
								</div>
			                 </div>
			                 </div>
							</td>
						</tr>
					</tfoot>
                  </table>
                  
                </div>
                <%@include file="/views/common/footer.jsp"%>
              </section>
             </section>
              
		<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		
		//实现选中取消切换图片
		$("tbody td>img").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    //$(this).parents("tr").children().each(function(){
			   // $(this).css("background","#D3F0F1");
		   //});    
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    //$(this).parents("tr").children().each(function(){
			    //$(this).css("background","");
		   //});
		    });
		    
		//实现全选切换所有选项图标
		$("#all").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
		    });
		
	</script>
	<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
	<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
